#include<iostream>
#include<string>
#include<vector>
using namespace std;
class FriendScore
{
public: 
int highestScore(vector <string> friends)
{
	int len = friends.size();
	int count[50] = {0};
	int i,j;
	for(i=0;i<len;i++)
	{
		for(j=0;j<len;j++)
		{
			if(i == j) continue;
			else if(friends[i][j] == 'Y')
			{
				count[i]++;
			}
			else
			{
				int k;
				for(k=0;k<len;k++)
				{
					if(friends[i][k] == 'Y' && friends[k][j] == 'Y')
					{
						count[i]++;
						break;
					}
				}
			}
		}
	}
	int max = -1;
	for(i=0;i<len;i++)
	{
		if(max < count[i])
			max = count[i];
	}
	return max;
}
};